#include <iostream>
#include <cstring>
using namespace std;
using ll=long long;
const int N=2*1e5+10;

int a[N];
int n;
ll tr[N];
ll heigher[N];
ll lower[N];
int lowbit(int x)
{
	return x&(-x);
}
void add(int x,int c)
{
	for(int i=x;i<=n;i+=lowbit(i))
	{
		tr[i]+=c;
	}
}
ll query(int x)
{
	ll ret=0;
	for(int i=x;i;i-=lowbit(i))
	{
		ret+=tr[i];
	}
	return ret;
}
int main()
{
	cin>>n;
	for(int i=1;i<=n;i++)
		scanf("%d",&a[i]);
		
	memset(tr,0,sizeof(tr));
	ll ret1=0,ret2=0;
	for(int i=1;i<=n;i++)
	{
		int y=a[i];
		heigher[i]=query(n)-query(y);
		lower[i]=query(y-1);
		add(y,1);
	}
	memset(tr,0,sizeof(tr));
	for(int i=n;i>=1;i--)
	{
		int y=a[i];
		ret1+=heigher[i]*(query(n)-query(y));
		ret2+=lower[i]*(query(y-1));
		add(y,1);
	}
	cout<<ret1<<' '<<ret2;
	return 0;
}
